home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <errno.h>
- #ifdef _AUDIO_
- #include <sys/audio.h>
- #define DEV "/dev/audio"
- #define PLAY_IOCTL_SPEED AUDIO_SAMPLE_RATE
- #else
- #include <sys/sb.h>
- #define DEV "/dev/sbdsp"
- #define PLAY_IOCTL_SPEED DSP_IOCTL_SPEED
- #endif
-
-
- main ( count , args )
- char * args [] ;
- {
- int speed ;
- int device ;
- int in ;
- FILE * dev_stream ;
-
- if ( count != 2 )
- {
- fprintf ( stderr , "\nUsage: %s speed\n" , args [ 0 ] ) ;
- return -1 ;
- }
-
- speed = atoi ( args [ 1 ] ) ;
-
- device = open ( DEV , O_WRONLY ) ;
- if ( device < 0 )
- {
- fprintf ( stderr , "\n%s: can't open %s for ioctl: %s\n" , args [ 0 ] , DEV , sys_errlist [ errno ] ) ;
- return -1 ;
- }
-
- if ( ioctl ( device , PLAY_IOCTL_SPEED , speed ))
- {
- fprintf ( stderr , "\n%s: can't ioctl: %s\n" , args [ 0 ] , sys_errlist [ errno ] ) ;
- return -1 ;
- }
-
- dev_stream = fdopen ( device , "a+" ) ;
-
- while (( in = getc ( stdin )) != EOF )
- {
- putc ( in , dev_stream ) ;
- }
- return 0 ;
- }
-